home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 7
/
Aminet 7 - August 1995.iso
/
Aminet
/
comm
/
tcp
/
Netdial4_0.lha
/
AmiTCP_Netdial4.0
/
RXSER502.LHA
/
testserial.rexx
< prev
Wrap
OS/2 REXX Batch file
|
1992-09-26
|
2KB
|
55 lines
/* rexxserdev.library test program used to debug function calls */
/* open the Rexx support library */
signal on error
if ~show('L',"rexxsupport.library") then do
if addlib('rexxsupport.library',0,-30,0) then
say 'added rexxsupport.library'
else do;
say 'support library not available'
exit 10
end
end
/* open the Rexx serial device library */
if ~show( 'L', "rexxserdev.library" ) then do
if addlib( 'rexxserdev.library', 0, -30, 0 ) then
say 'added rexxserdev.library'
else do;
say 'support library not available'
exit 10
end
end
libaddr = serlibbase()
say 'serial library base =' libaddr
dh = seropen( 'serial.device', 0 )
if dh = "" then say 'serial device not opened'
if serreset( dh ) then say 'serial device reset'
say serid()
if ~sersetparms( dh, 9600, 8, 'N', 1,,,5128 ) then say 'Parms not set'
if ~serclear( dh ) then say 'buffer not clear'
if serflush( dh, w ) then say 'write queue flushed'
if serflush( dh, r ) then say 'read queue flushed'
block = allocmem( 20 )
addr = c2d( block )
say 'memory block address =' addr
query = SerQuery( dh )
parse var query err rl stat
if ~err then say 'query status valid'
say 'number of characters in received buffer:' rl
say 'status word in ASCII decimal:' stat
say 'waiting for 5 characters from the remote'
text = SerRead( dh, addr, 5 )
say 'received:' text
if ~freemem( block, 20 ) then say 'memory block not freed'
text = 'send stuff out port again'
say 'calling SerWrite'
if ~serwrite( dh, text, length( text ) ) then say 'nothing written'
say 'back from SerWrite'
error:
if serclose( dh ) then say 'serial device closed'
if remlib( 'rexxserdev.library' ) then say 'removed rexxserdev.library'